package com.ruoyi.web.controller.questionPushRecord;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.questionPushRecord.domain.CircleQuestionPushRecord;
import com.ruoyi.questionPushRecord.service.ICircleQuestionPushRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 圈子题目推送记录Controller
 * 
 * @author 区嘉盛
 * @date 2025-06-26
 */
@RestController
@RequestMapping("/questionPushRecord/questionPushRecord")
@Tag(name = "【圈子题目推送记录】管理")
public class CircleQuestionPushRecordController extends BaseController
{
    @Autowired
    private ICircleQuestionPushRecordService circleQuestionPushRecordService;

    /**
     * 查询圈子题目推送记录列表
     */
    @Operation(summary = "查询圈子题目推送记录列表")
    @PreAuthorize("@ss.hasPermi('questionPushRecord:questionPushRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(CircleQuestionPushRecord circleQuestionPushRecord)
    {
        startPage();
        List<CircleQuestionPushRecord> list = circleQuestionPushRecordService.selectCircleQuestionPushRecordList(circleQuestionPushRecord);
        return getDataTable(list);
    }

    /**
     * 导出圈子题目推送记录列表
     */
    @Operation(summary = "导出圈子题目推送记录列表")
    @PreAuthorize("@ss.hasPermi('questionPushRecord:questionPushRecord:export')")
    @Log(title = "圈子题目推送记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CircleQuestionPushRecord circleQuestionPushRecord)
    {
        List<CircleQuestionPushRecord> list = circleQuestionPushRecordService.selectCircleQuestionPushRecordList(circleQuestionPushRecord);
        ExcelUtil<CircleQuestionPushRecord> util = new ExcelUtil<CircleQuestionPushRecord>(CircleQuestionPushRecord.class);
        util.exportExcel(response, list, "圈子题目推送记录数据");
    }

    /**
     * 获取圈子题目推送记录详细信息
     */
    @Operation(summary = "获取圈子题目推送记录详细信息")
    @PreAuthorize("@ss.hasPermi('questionPushRecord:questionPushRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(circleQuestionPushRecordService.selectCircleQuestionPushRecordById(id));
    }

    /**
     * 新增圈子题目推送记录
     */
    @Operation(summary = "新增圈子题目推送记录")
    @PreAuthorize("@ss.hasPermi('questionPushRecord:questionPushRecord:add')")
    @Log(title = "圈子题目推送记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CircleQuestionPushRecord circleQuestionPushRecord)
    {
        return toAjax(circleQuestionPushRecordService.insertCircleQuestionPushRecord(circleQuestionPushRecord));
    }

    /**
     * 修改圈子题目推送记录
     */
    @Operation(summary = "修改圈子题目推送记录")
    @PreAuthorize("@ss.hasPermi('questionPushRecord:questionPushRecord:edit')")
    @Log(title = "圈子题目推送记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CircleQuestionPushRecord circleQuestionPushRecord)
    {
        return toAjax(circleQuestionPushRecordService.updateCircleQuestionPushRecord(circleQuestionPushRecord));
    }

    /**
     * 删除圈子题目推送记录
     */
    @Operation(summary = "删除圈子题目推送记录")
    @PreAuthorize("@ss.hasPermi('questionPushRecord:questionPushRecord:remove')")
    @Log(title = "圈子题目推送记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable( name = "ids" ) Long[] ids) 
    {
        return toAjax(circleQuestionPushRecordService.deleteCircleQuestionPushRecordByIds(ids));
    }
}
